package com.guaoran.jpa.repository;

import com.guaoran.jpa.entity.VpgPackage;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;

/**
 * @author : 孤傲然
 * @Description :
 * @date :2018/1/23 15:11
 */
public interface VpgPackageRepository extends JpaRepository<VpgPackage,Long> {
    /**
     * 根据供应商id查询
     * @param providerId
     * @return
     */
    public List<VpgPackage> findVpgPackagesByProviderId(String providerId);
    /**
     * 根据资产id查询
     * @param assetId
     * @return
     */
    public List<VpgPackage> findVpgPackagesByAssetIdContaining(String assetId);
    /**
     * 根据资产名称or资产id模糊查询
     * @param assetName
     * @return
     */
    public List<VpgPackage> findByAssetIdContainingOrAssetNameContaining(String assetId, String assetName);

    /**
     * 通过providerId分页查询和assertName排序
     * @param providerId
     * @param pageable
     * @return
     */
    public Page<VpgPackage> findAllByProviderIdOrderByAssetName(String providerId, Pageable pageable);
    /**
     * 通过providerId分页查询和自定义排序
     * @param providerId
     * @param pageable
     * @return
     */
    public Page<VpgPackage> findAllByProviderId(String providerId, Pageable pageable);
}

